
#include "MoveCube.h"
#include "DirectInput.h"
#include <tchar.h>
#include <Windows.h>

int WINAPI WinMain(HINSTANCE hInstance
				  , HINSTANCE prevInstance
				  , PSTR cmdLine
				  , int showCmd)
{

	//standard input/ output/ error file pointers
	FILE *fpStdIn, *fpStdOut, *fpStdErr;


	#if defined(DEBUG) || defined(_DEBUG)
	_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );

	if(AllocConsole())
	{
		//Assign the stdin/ stdout/ stderr streams to the newly created console
		_tfreopen_s(&fpStdIn, _T("CONIN$"), _T("r"), stdin);
		_tfreopen_s(&fpStdOut, _T("CONOUT$"), _T("w"), stdout);
		_tfreopen_s(&fpStdErr, _T("CONOUT$"), _T("w"), stderr);
	}
	#endif

	MoveCube app(hInstance
		, "Fenetre windows"
		, D3DDEVTYPE_HAL
		, D3DCREATE_HARDWARE_VERTEXPROCESSING);
	gd3dApp = &app;

	DirectInput di (DISCL_NONEXCLUSIVE|DISCL_FOREGROUND, DISCL_NONEXCLUSIVE|DISCL_FOREGROUND);
	gDInput = &di;

	return gd3dApp->Run();
}
